Integration and Service ID for /incidents endpoint

Hello

I have to use the following endpoint to create an incident: https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE0MA-create-an-incident (must be this one).

I have the following problems:

  • The service object property is not documented anywhere.
  • It’s really not clear what Integration should be used. I assume it’s Events API (v1), but the only thing I get from there is the integration key, but I need a service ID (which I cannot find and is not documented anywhere).
  • The Events API (v1) docs tell you to use an integration or the option Use our API directly, which does not exit.

I’d appreciate any pointers please.

Thanks a lot

Hello!

The service object will be this pattern:

    "service": {
        "id": "PWIXJZS",
        "type": "service_reference"
    }

Almost all object references require the PagerDuty ID in id and the type which is usually [object_type]_reference. I usually use the provided example code payload on the API document pages to discover this information. You are correct that it isn’t well documented beyond that (from what I’ve found).

To your second question, there shouldn’t be a need for an integration in this case. Using the endpoint you linked will create the incident for the service selected. AFAIK, integrations are for creating incidents through the alert event endpoint, not the API v2 endpoint.

1 Like

Hi Fabio.

Preocts is right on the set up of the service object for creating an incident.

All the services in your account have a service id. You can find these most easily in the URL of the service’s page in the webui. It will look like https://mydomain.pagerduty.com/service-directory/{ServiceID}

Every service will have a unique ID.

You can also get a list of all the services in your account at the /services endpoint.
https://developer.pagerduty.com/api-reference/e960cca205c0f-list-services